package com.example.tests;

import com.example.fw.ContactHelper;

public class ContactData implements Comparable<ContactData>{
	private String id;
	private String firstname;
	private String lastname;
	private String address;
	private String telephonehome;
	private String telephonemobil;
	private String telephonework;
	private String email1;
	private String email2;
	private String bday;
	private String bmonth;
	private String byear;
	private String groupname;
	private String address2;
	private String home2;
	

	public ContactData() {
	}
	
	public ContactData(String id, String firstname, String lastname, String address,
			String telephonehome, String telephohemobil, String telephonework,
			String email1, String email2, String bday, String bmonth,
			String byear, String groupname, String address2, String home2) {
		this.id=id;
		this.firstname = firstname;
		this.lastname = lastname;
		this.address = address;
		this.telephonehome = telephonehome;
		this.telephonemobil = telephohemobil;
		this.telephonework = telephonework;
		this.email1 = email1;
		this.email2 = email2;
		this.bday = bday;
		this.bmonth = bmonth;
		this.byear = byear;
		this.groupname = groupname;
		this.address2 = address2;
		this.home2 = home2;
	}

	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		//result = prime * result
		//		+ ((firstname == null) ? 0 : firstname.hashCode());
		return result;
	}



	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstname == null) {
			if (other.firstname != null)
				return false;
		} else if (!firstname.equals(other.firstname))
			return false;
		return true;
	}



	@Override
	public String toString() {
		return "ContactData [firstname=" + firstname + ", lastname=" + lastname
				+ ", address=" + address + ", telephonehome=" + telephonehome
				+ ", telephonemobil=" + telephonemobil + ", telephonework="
				+ telephonework + ", email1=" + email1 + ", email2=" + email2
				+ ", bday=" + bday + ", bmonth=" + bmonth + ", byear=" + byear
				+ ", groupname=" + groupname + ", address2=" + address2
				+ ", home2=" + home2 + "]";
	}

	@Override
	public int compareTo(ContactData other) {
		return this.firstname.toLowerCase().compareTo(other.firstname.toLowerCase());
	}

	public ContactData withFirstName(String firstname) {
		this.firstname=firstname;
		return this;
	}
	public ContactData withLastName(String lastname) {
		this.lastname=lastname;
		return this;
	}
	public ContactData withAddress(String address) {
		this.address=address;
		return this;
	}
	public ContactData withTelephoneHome(String telephonehome) {
		this.telephonehome=telephonehome;
		return this;
	}
	public ContactData withTelephoneMobil(String telephonemobil) {
		this.telephonemobil=telephonemobil;
		return this;
	}
	public ContactData withTelephoneWork(String telephonework) {
		this.telephonework=telephonework;
		return this;
	}
	
	public ContactData withGroupName(String groupname) {
		this.groupname=groupname;
		return this;
	}
	
	public ContactData withEmail1(String email1) {
		this.email1=email1;
		return this;
	}
	public void setId(String id) {
		this.id = id;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setTelephonehome(String telephonehome) {
		this.telephonehome = telephonehome;
	}

	public void setTelephonemobil(String telephonemobil) {
		this.telephonemobil = telephonemobil;
	}

	public void setTelephonework(String telephonework) {
		this.telephonework = telephonework;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public void setBday(String bday) {
		this.bday = bday;
	}

	public void setBmonth(String bmonth) {
		this.bmonth = bmonth;
	}

	public void setByear(String byear) {
		this.byear = byear;
	}

	public void setGroupname(String groupname) {
		this.groupname = groupname;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	public void setHome2(String home2) {
		this.home2 = home2;
	}

	public ContactData withEmail2(String email2) {
		this.email2=email2;
		return this;
	}	
	public ContactData withBDay(String bday) {
		this.bday=bday;
		return this;
	}
	public ContactData withBMonth(String bmonth) {
		this.bmonth=bmonth;
		return this;
	}
	public ContactData withBYear(String byear) {
		this.byear=byear;
		return this;
	}
	public ContactData withAddress2(String address2) {
		this.address2=address2;
		return this;
	}	
	public ContactData withHome2(String home2) {
		this.home2=home2;
		return this;
	}
	
	public String getId() {
		return id;
	}
	
	public String getFirstname() {
		return firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public String getAddress() {
		return address;
	}

	public String getTelephonehome() {
		return telephonehome;
	}

	public String getTelephonemobil() {
		return telephonemobil;
	}

	public String getTelephonework() {
		return telephonework;
	}

	public String getEmail1() {
		return email1;
	}

	public String getEmail2() {
		return email2;
	}

	public String getBday() {
		return bday;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getByear() {
		return byear;
	}

	public String getGroupname() {
		groupname=ContactHelper.getRandomGroupModel();
		return groupname;
	}

	public String getAddress2() {
		return address2;
	}

	public String getHome2() {
		return home2;
	}
	
}